import 'package:m_todo/domain/entity/todo_entity.dart';
import 'package:m_todo/domain/service/todo_service.dart';

/// todoList 用例
class TodoUseCase {
  final TodoService todoService;

  TodoUseCase(this.todoService);

  /// 添加todo
  Future<TodoEntity> add(String content) {
    return todoService.add(content);
  }

  /// 勾选完成toto
  Future<void> done(int index) {
    return todoService.done(index);
  }

  /// 获取未完成todo
  Future<List<TodoEntity>> getUnDoneList() {
    return todoService.getUnDoneList();
  }

  /// 获取所有的todo
  Future<List<TodoEntity>> getAllList() {
    return todoService.getAllList();
  }

  /// 导出
  /// [targetPath] 目标路径
  /// [return] 导出文件的全路径
  Future<String> export(String targetPath) {
    return todoService.export(targetPath);
  }

  /// 导入
  /// [targetFilePath] 目标文件路径
  /// [return] 导入的item数量
  Future<int> import(String targetFilePath) {
    return todoService.import(targetFilePath);
  }
}
